﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ScormModel;

namespace WpfELearningAuthoringTool
{
    /// <summary>
    /// Interaction logic for TimeLimitConfiguration.xaml
    /// </summary>
    public partial class TimeLimitConfiguration : Window
    {
        private Item selectedItem;
        public TimeLimitConfiguration()
        {
            InitializeComponent();
        }

        public Item SelectedItem
        {
            get { return this.selectedItem; }
            set { this.selectedItem = value; }
        }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            string timeLimitAction = "";
            if (rbEM.IsChecked == false && rbENM.IsChecked == false && rbCM.IsChecked == false && rbCNM.IsChecked == false)
            {
                MessageBox.Show("Plesae select one option");
                return;
            }
            if (rbEM.IsChecked == true)
            {
                timeLimitAction = "exit,message";
            }
            else if (rbENM.IsChecked == true)
            {
                timeLimitAction = "exit,no message";
            }
            else if (rbCM.IsChecked == true)
            {
                timeLimitAction = "continue,message";
            }
            else if (rbCNM.IsChecked == true)
            {
                timeLimitAction = "continue,no message";
            }
            if (selectedItem != null)
                selectedItem.TimeLimitAction = timeLimitAction;
            Close();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }
    }
}
